/*
 * @Author: sky 11864026+jfcode81@user.noreply.gitee.com
 * @Date: 2025-09-18 17:54:01
 * @LastEditors: sky 11864026+jfcode81@user.noreply.gitee.com
 * @LastEditTime: 2025-10-22 18:03:14
 * @FilePath: \trading-center-pc\server\baseApi.ts
 * @Description: 基地管理相关接口与类型定义
 */
import { ItemObject, PageQuery } from '~/types/global'

/**
 * 找货管理相关接口
 */

/**
 * 获取找货分页列表
 * @param params 分页参数
 */
export const getFindGoodsListApi = (params: PageQuery) => {
  return $request.get({ url: 'front/sourcing/public/list', params })
}

/**
 * 获取找货详情
 * @param id 找货ID
 */
export const getFindGoodsDetailApi = (id: number) => {
  return $request.get({ url: `front/sourcing/public/detail/${id}` })
}

/**
 * 发布找货信息
 * @param params 找货发布请求参数
 */
export const publishFindGoodsApi = (params: FindGoodsPublishRequest) => {
  return $request.post({ url: 'front/sourcing/create', params })
}

/**
 * 更新找货信息
 * @param params 找货更新请求参数
 */
export const updateFindGoodsApi = (params: FindGoodsPublishRequest) => {
  return $request.post({ url: 'front/sourcing/update', params })
}

/**
 * 删除找货信息
 * @param id 找货ID
 */
export const deleteFindGoodsApi = (id: number) => {
  return $request.post({ url: `front/sourcing/delete/${id}` })
}

/**
 * 找货发布请求参数类型定义
 */
export interface FindGoodsPublishRequest {
  id: number
  userId: number
  contactPerson: string
  demandQuantity: string
  location: string
  title: string
  contactPhone: string
  productName: string
  budget: string
  imageUrls: string
  description: string
  isUrgent: boolean
  avatar: string
  createTime: string
}
